package com.study.shop.entity.po;

/**
 * 
 * @TableName category
 */
public class Category {
    /**
     * 分类id
     */
    private Integer id;

    /**
     * 分类名称
     */
    private String name;

    /**
     * 分类级别
     */
    private Integer level;

    /**
     * 上一级分类id。一级分类的上一级分类id为0
     */
    private Integer upLevel;

    /**
     * 分类id
     */
    public Integer getId() {
        return id;
    }

    /**
     * 分类id
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * 分类名称
     */
    public String getName() {
        return name;
    }

    /**
     * 分类名称
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 分类级别
     */
    public Integer getLevel() {
        return level;
    }

    /**
     * 分类级别
     */
    public void setLevel(Integer level) {
        this.level = level;
    }

    /**
     * 上一级分类id。一级分类的上一级分类id为0
     */
    public Integer getUpLevel() {
        return upLevel;
    }

    /**
     * 上一级分类id。一级分类的上一级分类id为0
     */
    public void setUpLevel(Integer upLevel) {
        this.upLevel = upLevel;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Category other = (Category) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getLevel() == null ? other.getLevel() == null : this.getLevel().equals(other.getLevel()))
            && (this.getUpLevel() == null ? other.getUpLevel() == null : this.getUpLevel().equals(other.getUpLevel()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getLevel() == null) ? 0 : getLevel().hashCode());
        result = prime * result + ((getUpLevel() == null) ? 0 : getUpLevel().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", name=").append(name);
        sb.append(", level=").append(level);
        sb.append(", upLevel=").append(upLevel);
        sb.append("]");
        return sb.toString();
    }
}